#pragma once

#include <vector>

#include "tm_maya_plugin.h"
#include "..\..\TimidEngine\include\tm_tmd2_file.h"

#include "tm_base_maya_export_target.h"

class TTMD2ExportTarget: public TBaseMayaExportTarget
{
public:
	TTMD2ExportTarget();
	~TTMD2ExportTarget();
	
	MStatus GetOutputPath(MString& target);
	MStatus SaveFile(MString filename);
	
	virtual void AddMesh(TMayaExportMesh& mesh);
	virtual void AddCollisionMesh(TMayaBaseMesh& mesh);
	virtual void AddLocator(TMayaExportLocator& locator);
	virtual void AddSkin(TMayaExportSkin& skin);
private:
	TTM2ModelData Data;

	std::vector<TMayaExportMesh> PolyMeshes;
	std::vector<TMayaBaseMesh> CollisionMeshes;
	std::vector<TMayaExportLocator> Locators;
	
	std::vector<TMayaExportWeight> FilteredWeights;
	
	TMayaExportSkin* Skin;

	void Compile();

	void CompilePolyMeshes();
	void CompileCollisionMeshes();
	void CompileLocators();
	void CompileSkin();
};

